package c

import (
	"github.com/flipped-aurora/gin-vue-admin/server/middleware"
	"github.com/gin-gonic/gin"
)

type UserRouter struct{}

func (s *UserRouter) InitUserRouter(Router *gin.RouterGroup) {
	userRouter := Router.Group("user")
	userRouterWithAuth := Router.Group("user").Use(middleware.JWTAuth())
	//userRouterWithAuth := Router.Group("user")
	{
		userRouter.POST("register", userApi.Register)                    // 用户注册
		userRouter.POST("login", userApi.Login)                          // 用户登录
		userRouter.POST("wx-one-tap-register", userApi.WxOneTapRegister) // 微信一键注册登录
	}
	{
		userRouterWithAuth.GET("getUserInfo", userApi.GetUserInfo)                                         // 获取个人主页信息
		userRouterWithAuth.PUT("setSelfInfo", userApi.SetSelfInfo)                                         // 更新用户信息
		userRouterWithAuth.POST("changePassword", userApi.ChangePassword)                                  // 修改密码
		userRouterWithAuth.POST("follow", userApi.FollowUser)                                              // 关注/取关用户
		userRouterWithAuth.GET("getUserInfoById", userApi.GetUserInfoById)                                 // 获取他人用户信息，根据ID获取用户信息（包含关注状态）
		userRouterWithAuth.POST("getFollowList", userApi.GetFollowList)                                    // 获取某个用户关注的粉丝列表
		userRouterWithAuth.POST("getFollowedList", userApi.GetFollowedList)                                // 某用户的粉丝列表
		userRouterWithAuth.GET("getUserIMToken", userApi.GetUserIMToken)                                   // 获取用户的im_token
		userRouterWithAuth.POST("logout", userApi.Logout)                                                  // 用户登出
		userRouterWithAuth.GET("getMajorDirectoryTree", userApi.GetMajorDirectoryTree)                     // 专业目录树
		userRouterWithAuth.GET("getMajorCategories", userApi.GetMajorCategories)                           // 获取专业大类
		userRouterWithAuth.GET("getMajorSubcategoriesByParentID", userApi.GetMajorSubcategoriesByParentID) // 根据父ID获取专业子类

		userRouterWithAuth.POST("majorAuth", userApi.MajorAuth) // 用户专业认证

	}
}
